<template>

    <div id="container">
        <section id="main">
            <h1 class="headLine01">メニュー</h1>
            <div class="comBox">
                <div class="mailForm">
                    <ul class="formList">
                        <div v-show="!menulist.length">
                            <li>メニューがありません</li>
                        </div>
                        <div v-show="menulist.length">
                            <li v-for="(menudetail, idx) in menulist" :key="idx" @click="goPage(idx)">
                                <input type="button" :value="menudetail.menuName">
                            </li>
                        </div>
                    </ul>
                </div>
            </div>
        </section>
    </div>

</template>

<script>

export default {
    data() {
        return {
            menulist: []
        }
    },

    created() {
        this.getInitData();
    },

    methods: {
        getInitData() {
            this.Api.get('menuList').then(res => {
                if (res.data.data) {
                    this.menulist = res.data.data;
                }
            }).catch(err => {
            });
        },

        goPage(idx) {
            let menudata = this.menulist[idx];
            // console.log(menudata.menuCode);
            // 10006スケジュール確認  10007 業務日報  10008 月次報告 
            if (menudata.menuCode == 10006) {
                this.$router.push('/manage/schedule');
            } else if (menudata.menuCode == 10003) {
                this.$router.push('/manage/reservation');
            } else if (menudata.menuCode == 10008) {
                this.$router.push('/manage/bonthlyBoard');
            }
        }

    }

}
</script>